def testBreackets(text):
    while '()' in text or '[]' in text or '{}' in text or '<>' in text or ' ' in text:
        text = text.replace('()', '')
        text = text.replace('[]', '')
        text = text.replace('{}', '')
        text = text.replace('<>', '')
        text = text.replace(' ', '')

    return not text
print('Введите скобочную последовательность: ')
s = input()
print(testBreackets(s)) #True
